/**
 * 文章接口模块
 */
import request from '@/utils/request'


/**
 * 获取频道的文章列表
 *
 */
export const getArticles = (channelId, params) => {
    if (channelId == 0) {
        return request({
            method: 'GET',
            url: `/article/selectArticle`,
            params
        })
    } else {
        return request({
            method: 'GET',
            url: `/article/all/${channelId}`,
            params
        })
    }

}

/**
 * 文章接口模块
 */
//  import request from '@/utils/request'

/**
 * 获取文章详情
 */
export const getArticleById = articleId => {
    return request({
        method: 'GET',
        url: `/article/one/${articleId}`
    })
}

/**
 * 收藏文章
 */
export const addCollect = articleId => {
    return request({
        method: 'GET',
        url: `/article/addCollect/${articleId}`
    })
}

/**
 * 取消收藏文章
 */
export const deleteCollect = articleId => {
    return request({
        method: 'GET',
        url: `/article/subtractCollect/${articleId}`
    })
}

/**
 * 点赞
 */
export const addLike = articleId => {
    return request({
        method: 'GET',
        url: `/article/addLike/${articleId}`
    })
}

/**
 * 取消点赞
 */
export const deleteLike = articleId => {
    return request({
        method: 'GET',
        url: `/article/subtractLike/${articleId}`
    })
}